<template>
	<view class="hot">
		<view class="">
			
		</view>
		<view class="hot-main" v-for="item in articleLists" :key="item.id" @click="tohotNew(item)">
			<view class="main">
				<view class="hot-title">{{item.title}}</view>
				<view class="hot-text">
					<text>{{item.author}}</text>
					<text style="margin-left: 10px;">{{item.time}}</text>
				</view>
			</view>
			<view class="hot-imgs" v-if="item.imgs">
				<img :src="item.imgs" alt="" srcset="" class="imgs">
			</view>
		</view>
		
	</view>
</template>

<script>
	import { $_getarticlelist } from "@/apis/index.js"
	import { ChangeTime } from "@/utils/time/ChangeTime.js"
	export default {
		data() {
			return { 
				articleLists:[],
				// author:"合肥飞墨设计"
				// id:1
				// imgs:"http://129.211.169.131:6368/article/article_1.jpg"
				// point:"1188"
				// time:"2022-09-21T08:17:58.000Z"
				// title:"我妈说：“最满意你家厨房！”"
				currentpage:1,
				times:[]
			};
		},
		async onLoad() {
			let _this=this
			let res=await $_getarticlelist({page:this.currentpage,pagesize:5}) 
			for (let item of res.data.data) {
				item.time=ChangeTime(item.time)
			} 
			_this.articleLists=res.data.data
			console.log(47,_this.articleLists);
			console.log(42,ChangeTime("2022-11-21 14:44"));
		},
		methods:{
			tohotNew(item){ 
				console.log(item); 
				uni.navigateTo({
					url:"/pages/hotNews/hotNews?item="+JSON.stringify(item)
				})
				this.articleLists.map(item=>item.time) 
				
			},
		}
	}
</script>

<style lang="scss">
.hot-main{
	margin: 10px 20px;
	display: flex;
	justify-content: space-between;
	flex: 1;
	.main{
		display: flex;
		flex-direction: column;
		justify-content: space-around;
		.hot-title{
			font-weight: bold;
		}
		.hot-text{
			font-size: 12px;
			color: #999; 
		}
	}
	.hot-imgs{
		.imgs{
			width: 175rpx;
			height: 175rpx;
		} 
	}
}
</style>
